// import OSS from 'ali-oss';
// 目前直接打包oss报错未解决，只能通过页面引用https://tower.im/projects/848ef504333d44aaaf21ff099c08fe7a/todos/61f8a6adbf03478abf4d342a403eeadf/

let protocol = window.location.protocol;
let bucket = window.LA && window.LA.bucket ? window.LA.bucket : 'dr-one';

let client = new OSS.Wrapper({
  region: 'oss-cn-hangzhou',
  accessKeyId: 'LTAIvPfrgTZaVoXV',
  accessKeySecret: 'rkyD4t1U5By7IIlWP6ceZDLDY80BKH',
	endpoint: protocol + '//oss-cn-qingdao.aliyuncs.com',
	bucket: bucket
});

function sign(object, options = {expires: 3600}) {
	return client.signatureUrl(object, options);
}

export default {
	sign: sign,
	signWithStyle: function(object, style, expires = 3600) {
		return sign(object, {
			process: 'style/' + style,
			expires: expires
		});
	}
}